fix(metro): normalize remaining Windows path comparisons#4819
Conversation
#4453 normalized most Windows path handling but left three raw comparisons between Metro-provided paths and `path.resolve`-generated paths, which can disagree on separators on Windows: - resolver: the init-host and remote-entry `originModulePath` checks and the patched-HMRClient check - babel plugin: the `blacklistedPaths` / `state.filename` check These now compare POSIX-normalized paths so they match correctly on Windows. Behavior on POSIX systems is unchanged (no separators to rewrite). Adds a resolver regression test that fails without the fix. Refs #4440
✅ Deploy Preview for module-federation-docs ready!
To edit notification comments on pull requests, go to your Netlify project configuration. |
🦋 Changeset detectedLatest commit: 30466bb The changes in this PR will be included in the next version bump. This PR includes changesets to release 46 packages
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
@module-federation/devtools
@module-federation/cli
create-module-federation
@module-federation/dts-plugin
@module-federation/enhanced
@module-federation/error-codes
@module-federation/esbuild
@module-federation/managers
@module-federation/manifest
@module-federation/metro
@module-federation/metro-plugin-rnc-cli
@module-federation/metro-plugin-rnef
@module-federation/metro-plugin-rock
@module-federation/modern-js
@module-federation/modern-js-v3
@module-federation/native-federation-tests
@module-federation/native-federation-typescript
@module-federation/nextjs-mf
@module-federation/node
@module-federation/observability-plugin
@module-federation/retry-plugin
@module-federation/rsbuild-plugin
@module-federation/rspack
@module-federation/rspress-plugin
@module-federation/runtime
@module-federation/runtime-core
@module-federation/runtime-tools
@module-federation/sdk
@module-federation/storybook-addon
@module-federation/third-party-dts-extractor
@module-federation/treeshake-frontend
@module-federation/treeshake-server
@module-federation/typescript
@module-federation/utilities
@module-federation/webpack-bundler-runtime
@module-federation/bridge-react
@module-federation/bridge-react-webpack-plugin
@module-federation/bridge-shared
@module-federation/bridge-vue3
@module-federation/inject-external-runtime-core-plugin
commit: |
Bundle Size Report11 package(s) changed, 30 unchanged. Package dist + ESM entry
Bundle targets
Consumer scenarios
Total dist (raw): 6.81 MB (+218 B (+0.0%)) Bundle sizes are generated with rslib (Rspack). Package-root metrics preserve the historical report. Tracked subpath exports such as |
What
A small follow-up to #4453 (Windows path normalization for Metro federation). That PR normalized most path handling but left a few raw comparisons between Metro-provided paths and
path.resolve-generated paths, which can disagree on separators on Windows.This normalizes the remaining spots to POSIX before comparing:
originModulePathchecks, plus the patched-HMRClient checkblacklistedPaths/state.filenamecheckWhy
On Windows,
path.resolveproduces\separators while Metro can report the same file with/, so these equality checks could silently miss and skip the federation special-casing.Impact
Validation
metro-coretests pass locally.Notes
Honest scoping: this is hardening that closes real gaps, not a verified end-to-end fix for the repro in #4440. The reporter is on a version that already includes #4453, and their own workaround patches point at Metro's
exportsmap and a third-party rock-js ESMimport()issue — neither of which lives here. Sharing this separately so the path-comparison gaps are closed regardless.Refs #4440